home *** CD-ROM | disk | FTP | other *** search
/ Leonardo the Inventor / Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso / LEOWINMV / DATABASE.DIR / 00095_Script_PRINT PICTURES < prev    next >
Text File  |  1996-03-28  |  5KB  |  161 lines

  1. -----------------------------------------------------------------------
  2. -- handler printItem determines if the item to be printed is text, a
  3. -- map or a picture and calls the appropriate print handler to print
  4. -- the item.
  5.  
  6. on printItem
  7.   global printButton
  8.   global clickedTopic
  9.   
  10.   activateButtonKeepActivated(the clickOn)
  11.   
  12.   -- switch off puppets so they don't print
  13.   --  set puppetList = []
  14.   --  set puppetList = getPuppetList()
  15.   --  setPuppets puppetList,0 
  16.   
  17.   -- first get the framelabel for this topic
  18.   --  set topicFrameLabel = getMarkerForTopic(clickedTopic)
  19.   
  20.   -- then determine if a portrait, a map or text is shown by determining
  21.   -- if the corresponding button is active
  22.   --  if the name of cast (the castNum of sprite pictureButton) = "Picture ACTIVATED" then
  23.   --    printPicture(topicFrameLabel)
  24.   --  end if
  25.   
  26.   --  if the name of cast (the castNum of sprite textButton) = "Text ACTIVATED" then
  27.   printTopicText
  28.   -- end if
  29.   
  30.   --  if the name of cast (the castNum of sprite mapButton) = "Map ACTIVATED" then
  31.   --    setTextField clickedTopic
  32.   --    set topicPrintFrame = topicFrameLabel && "PRT"
  33.   --    printFrame label(topicPrintFrame) + 1
  34.   --    setButtonState(textState,textButton)  
  35.   --  end if
  36.   
  37.   -- switch puppets back on
  38.   --  setPuppets puppetList,1
  39. end
  40.  
  41. -- ---------------------------------------------------------------
  42. -- Handler getMarkerForTopic
  43.  
  44. on getMarkerForTopic whichTopic
  45.   global topicMarkers
  46.   set topicLine = 1
  47.   
  48.   set the itemDelimiter = ":"
  49.   repeat with i = 1 to the number of lines in topicMarkers
  50.     if (item 1 of line i of topicMarkers = whichTopic) then
  51.       set marker = item 2 of line i of topicMarkers
  52.       set the itemDelimiter = ","
  53.       exit repeat
  54.     end if
  55.   end repeat
  56.   
  57.   return marker
  58.   
  59. end
  60.  
  61. -----------------------------------------------------------------------
  62. -- Handler printFrame does the actual printing of non-text items.
  63.  
  64. on printFrame aPrintFrame
  65.   global hilitTopic
  66.   
  67.   -- convert aPrintFrame to a number when printing a map
  68.   if stringP(aPrintFrame) then
  69.     set aPrintFrame = label(aPrintFrame)
  70.   end if
  71.   
  72.   set oldStageColor = the stagecolor
  73.   set the stageColor = 0
  74.   
  75.   set saveHilitTopicPos = the locH of sprite hilitTopic
  76.   set the locH of sprite hilitTopic = 3000
  77.   
  78.   printFrom aPrintFrame,aPrintFrame
  79.   
  80.   set the locH of sprite hilitTopic = saveHilitTopicPos
  81.   
  82.   set the stageColor = oldStageColor
  83.   
  84. end
  85.  
  86.  
  87. -----------------------------------------------------------------------
  88. -- handler setTextField sets up properties of the textfield containing
  89. -- the topic in the print frame.
  90.  
  91. on setTextField aTopic  
  92.   put " " into field "topicName"
  93.   set the textFont of field "topicName" = "Palatino"
  94.   set the textSize of field "topicName" = 18
  95.   set the textAlign of field "topicName" = "left"
  96.   put aTopic into field "topicName"
  97.   
  98. end
  99.  
  100. -----------------------------------------------------------------------
  101. -- handler setPuppets sets the puppets in list aList to state state
  102.  
  103. on setPuppets aList,state
  104.   repeat with i = 1 to count(aList)
  105.     puppetsprite getAt(aList,i),state
  106.   end repeat
  107. end
  108.  
  109. -----------------------------------------------------------------------
  110. -- handler getPuppetList returns a list of all the puppetsprites in the
  111. -- current frame
  112.  
  113. on getPuppetList
  114.   set puppetList = []
  115.   repeat with i = 1 to 48
  116.     if the puppet of sprite i then append(puppetList,i)
  117.   end repeat
  118.   
  119.   return puppetList
  120. end
  121.  
  122. -----------------------------------------------------------------------
  123. -- handler printLandscape prints a screenShot of the current 13" screen
  124. -- (640 wide by 480 tall), scaled up to fit an 11 x 8.5 inch page...
  125. -- (not recommended for monitors/windows smaller than 640 x 480 at this time):
  126.  
  127. on printLandscape
  128.   global utilObj
  129.   
  130.   openXObjHandler("MovieUtilities.XObj")
  131.   set utilObj =  MovieUtilities( mNew ) 
  132.   
  133.   if objectP( utilObj ) then
  134.     put utilObj( mPrintLandscape ) into result
  135.     if result < 0 then
  136.       alert "Sorry...Error" && result && "prevented printing from occurring."
  137.       exit
  138.     end if
  139.   else
  140.     alert "Sorry...no object has been created"
  141.   end if
  142.   
  143.   utilObj(mdispose)
  144.   closeXObjHandler("MovieUtilities.XObj")
  145. end
  146.  
  147. -----------------------------------------------------------------------
  148. -- handler printPicture prints a picture in landscape form.  The picture
  149. -- must be stored in a frame of the form <topicFrameLabel> && PRT. The
  150. -- handler has to go to the frame to print in landscape form. It then
  151. -- returns to the source frame and returns the buttonstates of the
  152. -- database.
  153.  
  154. on printPicture topicFrameLabel
  155.   global clickedTopic
  156.   
  157.   setTextField(clickedTopic)
  158.   set topicPrintFrame = topicFrameLabel && "PRT"
  159.   printFrame topicPrintFrame
  160.   showPicture
  161. end